# 1：单样本假设检验
#define vector of turtle weights
turtle_weights <- c(300, 315, 320, 311, 314, 309, 300, 308, 305, 303, 305, 301, 303)

# perform one sample t-test
print(t.test(x = turtle_weights, mu = 310))

# 2：R 中的两样本 t 检验
#define vector of turtle weights for each sample
sample1 <- c(300, 315, 320, 311, 314, 309, 300, 308, 305, 303, 305, 301, 303)
sample2 <- c(335, 329, 322, 321, 324, 319, 304, 308, 305, 311, 307, 300, 305)

# perform two sample t-tests
t.test(x = sample1, y = sample2)

# 3：R 中的配对样本 t 检验
#define before and after max jump heights
before <- c(22, 24, 20, 19, 19, 20, 22, 25, 24, 23, 22, 21)
after <- c(23, 25, 20, 24, 18, 22, 23, 28, 24, 25, 24, 20)

# perform paired samples t-test
t.test(x = before, y = after, paired = TRUE)
